package com.caltco.cargo.ops.modules.sys.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.caltco.cargo.ops.common.annotation.FieldColumn;
import com.caltco.cargo.ops.common.base.BaseEntity;
import com.caltco.cargo.ops.common.validator.group.AddGroup;
import com.caltco.cargo.ops.common.validator.group.UpdateGroup;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;

import java.io.Serializable;

/**
 * 
 *
 * @author yehao
 * @Date 2023-01-12 09:58
 */
@Data
@TableName("user")
@Schema(description = "用户实体类")
public class SysUserEntity extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;


    /**
     * UserId锁
     * 
     */
    @TableId(type = IdType.ASSIGN_ID)
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(description = "用户Id")
    private Long id;

    /**
     * 用户名
     *
     */
    @NotBlank(message="用户名不能为空", groups = {AddGroup.class, UpdateGroup.class})
    @Schema(description = "用户名")
    @FieldColumn(name = "用户名")
    private String username;


    @Schema(description = "爱好")
    @FieldColumn(name = "爱好")
    private String love;

    /**
     * 学号
     *
     */
    @NotBlank(message="用户名不能为空", groups = {AddGroup.class, UpdateGroup.class})
    @Schema(description = "学号")
    @FieldColumn(name = "学号")
    private String sno;

    @Schema(description = "号码")
    @FieldColumn(name = "号码")
    private String phone;

    /**
     * 学号
     *
     */
    @NotBlank(message="账号不能为空", groups = {AddGroup.class, UpdateGroup.class})
    @Schema(description = "账号")
    @FieldColumn(name = "账号")
    private String account;

    /**
     * 密码
     * 
     */
    @NotBlank(message="密码不能为空", groups = AddGroup.class)
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    @Schema(description = "密码")
    private String password;

    /**
     * 邮箱
     * 
     */
    @Schema(description = "邮箱")
    @FieldColumn(name = "邮箱")
    @NotBlank(message="邮箱不能为空", groups = {AddGroup.class, UpdateGroup.class})
    @Email(message="邮箱格式不正确", groups = {AddGroup.class, UpdateGroup.class})
    private String email;

    /**
     * 用户头像
     * 
     */
    @Schema(description = "用户头像")
    @TableField("user_photo")
    @JsonProperty("userPhoto")
    private String userPhoto;

    /**
     * 性别
     * 
     */
    @Schema(description = "性别")
    @FieldColumn(name = "性别")
    private String sex;

    /**
     * 性别
     *
     */
    @Schema(description = "年龄")
    @FieldColumn(name = "年龄")
    private Integer age;

    @Schema(description = "学校")
    @FieldColumn(name = "学校")
    private String school;

    @Schema(description = "简历")
    @FieldColumn(name = "简历")
    private String resume;

}
					
					
					
					
				